//package com.base.data.elasticsearch.core.listener;
//
//import cn.hutool.core.util.StrUtil;
//import cn.hutool.crypto.asymmetric.KeyType;
//import cn.hutool.crypto.asymmetric.RSA;
//import sun.security.rsa.RSAUtil;
//
///**
// * cc.ketianyun.com copyright
// *
// * @Author kurt.ding
// * @Description
// * @Date 2020/12/4
// */
//
//public class PasswordUtils {
//    private final static String PRIVATE_KEY="MIICXAIBAAKBgQDMpO4wRI1ZAxduEnNi+jakaG8nUvX62VPFT0rX+E3j9GYgviQW\n" +
//            "951moxdgj0XcDOBkKSm1AtMLzDu9j1QBcTpPiXR73ekHT3Dzr8GiD4D3AptD10Y6\n" +
//            "uUX+aHiV2BBJddghB7P3WtmlDdeK52alTD810lFfu7WhUBWCwTeHkDzPawIDAQAB\n" +
//            "AoGAKeITkbNmDnKwh+mkzfwR1OI+5Zh4GYgDOh25XqxGHMJ3aHoh3sV85HW6ohuQ\n" +
//            "m7HS9wzpqU9TrFV3YJuGAOmQmjrThaiw3fQSmeNHnial8bUQyIH/cN2DoE1hTf/8\n" +
//            "9qns2uPuTad8CfsXavADi57DUaJVrGlSxkJPhn6Lj9inWZkCQQDzkRPEStpFKP7C\n" +
//            "6CH8+QixUnQdaOh5UwgO435Ce/H+iR0OmiZhVfgii8sj7bFy5zssQcZOIIM6DDQP\n" +
//            "iis4O32FAkEA1xc3PGbLlqDvrceqcCo2Sl2uNxuLTHDlHXz6s58X/P70FBqRjlpA\n" +
//            "AxuJkf4QpNH88hMPCSruY33GDmowk1b0LwJAF26wqSTOZPLxt4yfoHfQ90ZId3/d\n" +
//            "RbbQQqZuQjUsbeGBEyOPZ7PeoGw0ietXNAe88KAPVPrZxR7hb1FKoSlQBQJBAKjT\n" +
//            "IBfY15OzXm0Yez7u4w4b2dKHXB7zveIXZu/1v+5kb1AYSodhbz0BMEnXEVlNOS0I\n" +
//            "qJSZjeOppPtLfjUn2yECQFJLH4ScBbOxNOf1FxILUB+H7AdPdoLA5uBivNIpywjO\n" +
//            "zrNBQfJ3phEzYlfpKV3L4MER4/VTGfSV6dgrofn7SEw=";
//
//    public final static String PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMpO4wRI1ZAxduEnNi+jakaG8n" +
//            "UvX62VPFT0rX+E3j9GYgviQW951moxdgj0XcDOBkKSm1AtMLzDu9j1QBcTpPiXR7" +
//            "3ekHT3Dzr8GiD4D3AptD10Y6uUX+aHiV2BBJddghB7P3WtmlDdeK52alTD810lFf" +
//            "u7WhUBWCwTeHkDzPawIDAQAB";
//
//    public static String decode(String str) {
//        RSA rsa = new RSA(PRIVATE_KEY, null);
//        byte[] aByte = java.util.Base64.getDecoder().decode(str);
//        byte[] decrypt = rsa.decrypt(aByte, KeyType.PrivateKey);
//        return new String(decrypt);
//    }
//
//    public static String encode(String str) {
//        RSA rsa = new RSA(null, PUBLIC_KEY);
////        String a = "2707F9FD4288CEF302C972058712F24A5F3EC62C5A14AD2FC59DAB93503AA0FA17113A020EE4EA35EB53F"
////                + "75F36564BA1DABAA20F3B90FD39315C30E68FE8A1803B36C29029B23EB612C06ACF3A34BE815074F5EB5AA3A"
////                + "C0C8832EC42DA725B4E1C38EF4EA1B85904F8B10B2D62EA782B813229F9090E6F7394E42E6F44494BB8";
//        //    byte[] aByte = HexUtil.decodeHex(str);
//        byte[] result= rsa.encrypt(StrUtil.bytes(str),KeyType.PublicKey);
//        return java.util.Base64.getEncoder().encodeToString(result);
//    }
//
//    public static void main(String[] args) {
//        String passwordEncode = "l6sFBjj9WFLNL0dfOX2tl%2Ff0e5mvYl4N9m7y6CAjyrEO4Sm26CWx0zkTr9dcPH96KBQFWRCmjXkrcigTXzIaE1tEwN45XPKOZILdVWDK9zMltU1XJVfOEG0ITHEbnOlGFWOZ4slUyYPJRP0SHlYxspIoK4eaXZljbkQUXUcn4js%3D";
//        String name = "1231";
//        long start=System.nanoTime();
//        String passwordEncodeJava = encode("333333");
//        System.out.println(System.nanoTime()-start);
//        System.out.println(passwordEncodeJava);
//        long decodeStart=System.nanoTime();
//        System.out.println(decode(passwordEncodeJava));
//        System.out.println(decode("dQTrb3C18/h2e293wAQf396JZ3yTOOQJh58Rq8mWOdUoTpCKEVE1QPFitJAzZcywZM5h0oSawkv9FM+tQOXdGMrcVdRuD3Rmqaq/1L1d74UzOpu9HvimwmKiweUo9N7QfXN+u8WQnBerFPIbVi7KsFy60nLvgV2ZARmUT6rG8Jw="));
//        System.out.println(System.nanoTime()-decodeStart);
////        RSA rsa=new RSA(PRIVATE_KEY,PUBLIC_KEY);
////        byte[] encrypt = rsa.encrypt(StrUtil.bytes("我是一段测试aaaa", CharsetUtil.CHARSET_UTF_8), KeyType.PublicKey);
////        System.out.println(encrypt.toString());
////        byte[] decrypt = rsa.decrypt(encrypt, KeyType.PrivateKey);
////        rsa.decrypt(StrUtil.bytes(encrypt.toString()),KeyType.PrivateKey);
////        System.out.println(decrypt.toString());
//    }
//    public static String getPublicKey() {
//        return PUBLIC_KEY;
//    }
//}
